package com.fsnbigdata.service.impl;
import com.fsnbigdata.service.api.EnterpriseImageService;
import org.springframework.roo.addon.layers.service.annotations.RooServiceImpl;
import com.fsnbigdata.domain.Enterprise;
import com.fsnbigdata.domain.EnterpriseImage;
import com.fsnbigdata.repository.EnterpriseImageRepository;
import io.springlets.data.domain.GlobalSearch;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * = EnterpriseImageServiceImpl
 *
 * TODO Auto-generated class documentation
 *
 */
@RooServiceImpl(service = EnterpriseImageService.class)
@Service
@Transactional(readOnly = true)
public class EnterpriseImageServiceImpl implements EnterpriseImageService {

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    private EnterpriseImageRepository enterpriseImageRepository;

    /**
     * TODO Auto-generated constructor documentation
     *
     * @param enterpriseImageRepository
     */
    @Autowired
    public EnterpriseImageServiceImpl(EnterpriseImageRepository enterpriseImageRepository) {
        setEnterpriseImageRepository(enterpriseImageRepository);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return EnterpriseImageRepository
     */
    public EnterpriseImageRepository getEnterpriseImageRepository() {
        return enterpriseImageRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterpriseImageRepository
     */
    public void setEnterpriseImageRepository(EnterpriseImageRepository enterpriseImageRepository) {
        this.enterpriseImageRepository = enterpriseImageRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param entity
     * @return EnterpriseImage
     */
    @Transactional
    public EnterpriseImage save(EnterpriseImage entity) {
        return getEnterpriseImageRepository().save(entity);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return EnterpriseImage
     */
    public EnterpriseImage findOne(Long id) {
        return getEnterpriseImageRepository().findOne(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return EnterpriseImage
     */
    public EnterpriseImage findOneForUpdate(Long id) {
        return getEnterpriseImageRepository().findOneDetached(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param ids
     * @return List
     */
    public List<EnterpriseImage> findAll(Iterable<Long> ids) {
        return getEnterpriseImageRepository().findAll(ids);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @param globalSearch
     * @param pageable
     * @return Page
     */
    public Page<EnterpriseImage> findByEnterprise(Enterprise enterprise, GlobalSearch globalSearch, Pageable pageable) {
        return getEnterpriseImageRepository().findByEnterprise(enterprise, globalSearch, pageable);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param enterprise
     * @return Long
     */
    public long countByEnterprise(Enterprise enterprise) {
        return getEnterpriseImageRepository().countByEnterprise(enterprise);
    }

    @Override
    public List<String> getUrl(Long id) {
        return getEnterpriseImageRepository().getUrl(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<EnterpriseImage> getEntityType() {
        return EnterpriseImage.class;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<Long> getIdType() {
        return Long.class;
    }
}
